import java.util.*;

public class LCA {
    public int getLCA(int a, int b) {
        // write code here
        int n = Math.max(a,b);
        int m =Math.min(a,b);
        for (int i= n ; i>0 ;i/=2){

            for (int j= m ;j>0 ;j/=2){
                if(i==j){
                    return i;
                }
            }
        }
        return 0;
    }
}